package com.hucii.app.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SharePreferenceManager {

	public static final String EMAIL_INFO = "email_info";
	public static final String EMAIL = "mail";
	public static final String PASSWORD = "password";

	public void saveEmail(Context context, String email) {

		SharedPreferences share = context.getSharedPreferences(EMAIL_INFO, Context.MODE_PRIVATE);
		Editor editor = share.edit();
		editor.putString(EMAIL, email);
		editor.commit();
	}

	public void savePasswrod(Context context, String password) {

		SharedPreferences share = context.getSharedPreferences(EMAIL_INFO, Context.MODE_PRIVATE);
		Editor editor = share.edit();
		editor.putString(PASSWORD, password);
		editor.commit();
	}

	public String getPassword(Context context) {
		SharedPreferences share = context.getSharedPreferences(EMAIL_INFO, Context.MODE_PRIVATE);
		return share.getString(PASSWORD, "");
	}

	public String getEmailAddress(Context context) {
		SharedPreferences share = context.getSharedPreferences(EMAIL_INFO, Context.MODE_PRIVATE);
		return share.getString(EMAIL, "");
	}

	public void clearEmail(Context context) {
		SharedPreferences share = context.getSharedPreferences(EMAIL_INFO, Context.MODE_PRIVATE);
		Editor editor = share.edit();
		editor.clear();
		editor.commit();
	}

}
